/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package byzantine.controls.listeners;

import byzantine.ByzantineModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;

/**
 *
 * @author Ryhan
 */
public class StartSimulationListener implements ActionListener {

    ByzantineModel model;

    public StartSimulationListener(ByzantineModel model) {
        this.model = model;
    }

    public void actionPerformed(ActionEvent event) {
        if (model.getNumGenerals() < (model.getNumTraitors() * 3) + 1) {
            JOptionPane.showMessageDialog(null, "Algorithm not guaranteed to succeed with more than 1/3 of the generals as traitors", "Warning", JOptionPane.INFORMATION_MESSAGE);
        }
        model.runSimulation();
    }
}